﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SASS.Sociales.BE;
using SASS.Sociales.BLL;
using SASS.Sociales.Util;

public partial class act_lista : BasePage
{

    #region "Iniciar Pagina"

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CargarDatos();
        }
    }

    #endregion

    #region "Cargar Datos"

    private void CargarDatosIniciales()
    {
        this.Master.TituloPagina = this.TituloPaginaActual();
    }

    private void CargarDatos()
    {

        ActorBE oActor = new ActorBE();
        ActorBL oActoBL = new ActorBL();
        List<ActorBE> lstActor = new List<ActorBE>();

        lstActor = oActoBL.Listar_Actor_SELALL(txtDescripcion.Text);
        if (lstActor == null)
        {
            grvLista.DataSource = null;
            grvLista.DataBind();
        }
        else
        {
            grvLista.DataSource = lstActor;
            grvLista.DataBind();
            if (lstActor.Count > grvLista.PageSize) {
                grvLista.FooterRow.Visible = false;    
            }
            
        }

    }

    #endregion

    #region "Eventos de Controles"

    protected void grvLista_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //ActorBE oActor = new ActorBE();
            //ActorBE DataItem = new ActorBE();
            //e.Row.Cells[0].Text = oActor.Codigo.ToString();
        }

    }

    protected void grvLista_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grvLista.PageIndex = e.NewPageIndex;
        CargarDatos();
    }

    #endregion


}